package com.yupi.yupicturebackend.model.enums;

import com.yupi.yupicturebackend.exception.BusinessException;
import com.yupi.yupicturebackend.exception.ErrorCode;
import lombok.Getter;

@Getter
public enum PictureReviewStatusEnums {
    REVIEW("待审核",0),
    PASS("通过",1),
    REJECT("拒绝",2);

    private final String text;

    private final int value;

    PictureReviewStatusEnums(String text,int value){
        this.text=text;
        this.value=value;
    }
    public static PictureReviewStatusEnums getEnumByValue(int value){
        if (value==0){
            throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数为空");
        }
        for (PictureReviewStatusEnums pictureReviewStatusEnums : PictureReviewStatusEnums.values()) {
            if (pictureReviewStatusEnums.value==value){
                return pictureReviewStatusEnums;
            }
        }
        return null;
    }
}
